cmake_minimum_required(VERSION 3.10)
project(Server)

include_directories(${PROJECT_SOURCE_DIR}/inc)
include_directories(${PROJECT_SOURCE_DIR}/inc/Request)
include_directories(${PROJECT_SOURCE_DIR}/inc/Notify)
include_directories(${PROJECT_SOURCE_DIR}/inc/Notify/LatestMsgNumNotify)
include_directories(${PROJECT_SOURCE_DIR}/inc/ChatRoom)
include_directories(${PROJECT_SOURCE_DIR}/inc/User)
include_directories(${PROJECT_SOURCE_DIR}/inc/Msg)


include_directories(${PROJECT_SOURCE_DIR}/src/Test)


file(GLOB_RECURSE SOURCES src/*.cpp)

message("SOURCES: ${SOURCES}\n")

# 复制 SOURCES 到 MAIN_SOURCES 和 TEST_SOURCES
set(MAIN_SOURCES ${SOURCES})
set(TEST_SOURCES ${SOURCES})

# 从 MAIN_SOURCES 中移除 test.cpp
list(REMOVE_ITEM MAIN_SOURCES ${PROJECT_SOURCE_DIR}/src/test.cpp)
message("MAIN_SOURCES: ${MAIN_SOURCES}\n")

# # 从 TEST_SOURCES 中移除 main.cpp
# list(REMOVE_ITEM TEST_SOURCES ${PROJECT_SOURCE_DIR}/src/main.cpp)
# message("TEST_SOURCES: ${TEST_SOURCES}\n")

#忽略警告
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
    # 使用 GCC 或 Clang 编译器时
    add_compile_options(-w)
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
    # 使用 MSVC 编译器时
    add_compile_options(/W0)
endif()


# 添加可执行文件
add_executable(app ${MAIN_SOURCES})
add_executable(test ${PROJECT_SOURCE_DIR}/src/test.cpp)
